// import dom from './lib/dom.js';
import { UIPanel, UIRow, UIHorizontalRule } from './lib/ui.js';

function MenubarObject(editor) {

	const strings = editor.strings

	var container = new UIPanel();
	container.setClass('menu');

	// 文件
	var title = new UIPanel();
	title.setClass('title');
	title.setTextContent(strings.getKey('menubar/object'));
	container.add(title);

	// Group
	var options = new UIPanel();
	options.setClass('options');
	container.add(options);


	var option = new UIRow();
	// option.setClass('option');
	option.setClass('inactive');
	option.setTextContent(strings.getKey('menubar/object/group'));
	options.add(option);
	// option.onClick(function (event) {
	// 	alert('敬请期待!')
	// });

	var option = new UIRow();
	// option.setClass('option');
	option.setClass('inactive');
	option.setTextContent(strings.getKey('menubar/object/unGroup'));
	options.add(option);
	// option.onClick(function (event) {
	// 	alert('敬请期待!')
	// });

	var hr = new UIHorizontalRule();
	options.add(hr);


	var option = new UIRow();
	option.setClass('option');
	option.setTextContent(strings.getKey('menubar/object/bringFront'));
	options.add(option);
	option.onClick(function (event) {
		let el = editor.layers.getSelectedElement();
		editor.layers.moveFront(el);
	});



    var option = new UIRow();
	option.setClass('option');
	option.setTextContent(strings.getKey('menubar/object/bringForward'));
	options.add(option);
	option.onClick(function (event) {
		let el = editor.layers.getSelectedElement();
		editor.layers.moveUp(el);
	});

    var option = new UIRow();
	option.setClass('option');
	option.setTextContent(strings.getKey('menubar/object/bringBackward'));
	options.add(option);
	option.onClick(function (event) {
		let el = editor.layers.getSelectedElement();
		editor.layers.moveDown(el);
	});
	
    var option = new UIRow();
	option.setClass('option');
	option.setTextContent(strings.getKey('menubar/object/bringBack'));
	options.add(option);
	option.onClick(function (event) {
		let el = editor.layers.getSelectedElement();
		editor.layers.moveBack(el);
	});



	var hr = new UIHorizontalRule();
	options.add(hr);

    // 删除
    var option = new UIRow();
	option.setClass('option');
	option.setTextContent(strings.getKey('menubar/object/delete'));
	options.add(option);
	option.onClick(function () {
		let el = editor.layers.getSelectedElement();
		editor.layers.remove(el);
	});


	return container;

}

export { MenubarObject };
